package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.property.PropertyMealManageGetDTO;
import com.itlong.cloud.POJO.VO.app.AppElevatorMealInfoVO;
import com.itlong.cloud.POJO.VO.property.PropertyMealManageGetVO;
import com.itlong.cloud.paymenthub.IPropertyMealManageServiceClient;
import com.itlong.cloud.property.service.IPropertyMealManageService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <desc>
 *      共享电梯套餐管理暴露接口实现类。
 * <desc/>
 *
 * @createDate 2020/07/15
 */
@RestController
public class PropertyMealManageServiceResource implements IPropertyMealManageServiceClient {

    @Autowired
    IPropertyMealManageService iPropertyMealManageService;

    /**
     * <desc>
     *      共享电梯套餐信息分页查询
     * <desc/>
     *
     * @param propertyMealManageGetDTO 分页查询参数
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/getMealManageByPage",method = {RequestMethod.POST})
    public Page<PropertyMealManageGetVO> getMealManageByPage(@RequestBody PropertyMealManageGetDTO propertyMealManageGetDTO) throws Exception{
        return iPropertyMealManageService.getMealManageByPage(propertyMealManageGetDTO);
    }

    /**
     * <desc>
     *      添加共享电梯套餐
     * <desc/>
     *
     * @param propertyMealManageGetDTO 分页查询参数
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/saveMealManageInfo",method = {RequestMethod.POST})
    public Integer saveMealManageInfo(@RequestBody PropertyMealManageGetDTO propertyMealManageGetDTO) throws Exception{
        return iPropertyMealManageService.saveMealManageInfo(propertyMealManageGetDTO);
    }

    /**
     * <desc>
     *      查看共享电梯套餐
     * <desc/>
     *
     * @param mealId 套餐编号
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/getMealManageDetail",method = {RequestMethod.POST})
    public PropertyMealManageGetVO getMealManageDetail(@RequestParam("mealId") String mealId) throws Exception{
        return iPropertyMealManageService.getMealManageDetail(mealId);
    }

    /**
     * <desc>
     *      查询套餐是否使用
     * <desc/>
     *
     * @param mealId 套餐编号
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/checkMeal",method = {RequestMethod.POST})
    public Integer checkMeal(@RequestParam("mealId") String mealId) throws Exception{
        return iPropertyMealManageService.checkMeal(mealId);
    }

    /**
     * <desc>
     *      删除套餐
     * <desc/>
     *
     * @param mealId 套餐编号
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/deleteMealManageInfo",method = {RequestMethod.POST})
    public Integer deleteMealManageInfo(@RequestParam("mealId") String mealId) throws Exception{
        return iPropertyMealManageService.deleteMealManageInfo(mealId);
    }

    /**
     * <desc>
     *      更新共享电梯套餐
     * <desc/>
     *
     * @param propertyMealManageGetDTO 分页查询参数
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/updateMealManageInfo",method = {RequestMethod.POST})
    public Integer updateMealManageInfo(@RequestBody PropertyMealManageGetDTO propertyMealManageGetDTO) throws Exception{
        return iPropertyMealManageService.updateMealManageInfo(propertyMealManageGetDTO);
    }

    /**
     * <desc>
     *      移动共享电梯套餐
     * <desc/>
     *
     * @param propertyMealManageGetDTO 分页查询参数
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/moveMealManageInfo",method = {RequestMethod.POST})
    public void moveMealManageInfo(@RequestBody PropertyMealManageGetDTO propertyMealManageGetDTO) throws Exception{
        iPropertyMealManageService.moveMealManageInfo(propertyMealManageGetDTO);
    }

    /**
     * <desc>
     *      APP获取乘梯缴费套餐列表
     * <desc/>
     *
     * @param projectId 项目编号
     * @param roomId 房间编号
     * @return
     * @author Qiang.S
     * @createDate 2020/07/15
     */
    @Override
    @RequestMapping(path="/property/sharedElevator/mealManage/getMealManageByProjectId",method = {RequestMethod.POST})
    public List<AppElevatorMealInfoVO> getMealManageByProjectId(@RequestParam("projectId") String projectId, @RequestParam("roomId") String roomId) throws Exception{
        return iPropertyMealManageService.getMealManageByProjectId(projectId,roomId);
    }
}
